package com.scy.controller;


import com.scy.pojo.User;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.atomic.AtomicInteger;

@RestController
@RequestMapping("/scy")
public class GetMemController {

    private AtomicInteger count = new AtomicInteger(0);
    private static List<byte[]> list = new ArrayList<>();
    private static final Logger logger = LoggerFactory.getLogger(GetMemController.class);

    @RequestMapping("/count")
    @ResponseBody
    public User test1( ) {

        User user = new User();
        logger.info("进入test1方法了");

        byte[] bytesArr = new byte[1024 * 1024 * 10];// 10mb
        list.add(bytesArr);

        user.setName("访问的次数");
        int result = count.incrementAndGet();
        System.out.println("访问的次数为:"+result);
        user.setAddr(""+result );
        return user;
    }
}

